package com.atguigu.java.ai.langchain4j.config;

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.pinecone.PineconeEmbeddingStore;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class EmbeddingStoreConfig {
//    @Bean
//    public EmbeddingStore embeddingStore(){
//        return EmbeddingStore.;S
//    }

    /**
     * 创建向量数据库
     * @return
     */

    @Bean
    public EmbeddingStore<TextSegment> embeddingStore() {

        EmbeddingStore<TextSegment> embeddingStore = PineconeEmbeddingStore.builder()
                .apiKey("pcsk_59dVVt_UPMXyZAGGtXuEGY2eRAh192piPDCE6S1ZpUCLZ3ihAEwmcXnmYbrAb12MLHJsye")
                .index("xiaozhi-index")
                .nameSpace("default")
//                .createIndex(PineconeServerlessIndexConfig.builder()
//                        .cloud("AWS")
//                        .region("us-east-1")
//                        .dimension(embeddingModel.dimension())
//                        .build())
                .build();

        return embeddingStore;
    }

}
